package Service;

import Controller.*;

import java.util.HashMap;

public class GetContronller {
    public GetContronller() {
    }

    private  ChatMain chatMainController;
    private AddFriend addFriendController;
    private PrivateInformation privateInformationController;
    private HashMap<String,ChatWithStage> map=new HashMap<>();
    private Controller.loginController loginController;
    private ResetPwd resetPwdController;
    private RegisterController registerController;

    private HashMap<String,VerifyFriends>verifyFriendsHashMap=new HashMap<>();

    private AddFriend addgroup=null;

    private HashMap<String,PrivateInformation> privateInformationHashMap=new HashMap<>();

    private HashMap<String,InviteOtherToGroup> inviteOtherToGroupHashMap=new HashMap<>();

    public AddFriend getAddgroup() {
        return addgroup;
    }

    public void setAddgroup(AddFriend addgroup) {
        this.addgroup = addgroup;
    }

    //打开群聊的窗口

    public InviteOtherToGroup getInviteOtherToGroupControllerById(String id)
    {
        if(inviteOtherToGroupHashMap.containsKey(id))
        {
            return inviteOtherToGroupHashMap.get(id);
        }
        else return null;
    }

    public boolean IsExistInviteOtherToGroupController(String id)
    {
        return inviteOtherToGroupHashMap.containsKey(id);
    }

    public void AddInviteToOtherGroupController(String id,InviteOtherToGroup inviteOtherToGroup)
    {
        inviteOtherToGroupHashMap.put(id,inviteOtherToGroup);
    }

    public void RemoveInviteToOtherController(String id)
    {
        inviteOtherToGroupHashMap.remove(id);
    }

    private HashMap<String,GroupStage>groupStageHashMap=new HashMap<>();

    public void AddPrivateInformationController(String id,PrivateInformation privateInformation)
    {
        privateInformationHashMap.put(id,privateInformation);
    }

    public boolean IsExistPrivateInforMationController(String id)
    {
        return privateInformationHashMap.containsKey(id);
    }

    public PrivateInformation getPrivateInformationControllerById(String id)
    {
        PrivateInformation privateInformation=privateInformationHashMap.get(id);
        if(privateInformation==null)
        {
            return null;
        }
        else return privateInformation;
    }

    public void AddGroupStage(String id, GroupStage groupStage)
    {
        groupStageHashMap.put(id,groupStage);
    }

    public boolean IsExistGroupStage(String id)
    {
        return groupStageHashMap.containsKey(id);
    }

    public void RemoveGroupStage(String id)
    {
        groupStageHashMap.remove(id);
    }

    public GroupStage getGroupStage(String id)
    {
        if(groupStageHashMap.containsKey(id))
        {
            return groupStageHashMap.get(id);
        }
        else return null;
    }

    public VerifyFriends getVerifyFriendStagById(String id)
    {
        if(verifyFriendsHashMap.containsKey(id))
        {
            return verifyFriendsHashMap.get(id);
        }
        return null;
    }

    public void AddVerifyFriendStage(String id,VerifyFriends verifyFriends)
    {
        verifyFriendsHashMap.put(id,verifyFriends);
    }

    public void RemoveVerifyFriendStage(String id)
    {
        verifyFriendsHashMap.remove(id);
    }
    public ChatWithStage getChatWithStageById(String id)
    {
        if(map.containsKey(id))
        {
            return map.get(id);
        }
        return null;
    }
    public ResetPwd getResetPwdController() {
        return resetPwdController;
    }

    public void setResetPwdController(ResetPwd resetPwdController) {
        this.resetPwdController = resetPwdController;
    }

    public RegisterController getRegisterController() {
        return registerController;
    }

    public void setRegisterController(RegisterController registerController) {
        this.registerController = registerController;
    }

    public void AddChatWithStage(String id, ChatWithStage chatWithStageController)
    {
        map.put(id,chatWithStageController);
    }
    public void RemoveChatWithStage(String id)
    {
        map.remove(id);
    }
    public ChatMain getChatMainController() {
        return chatMainController;
    }

    public void setChatMainController(ChatMain chatMainController) {
        this.chatMainController = chatMainController;
    }

    public AddFriend getAddFriendController() {
        return addFriendController;
    }

    public void setAddFriendController(AddFriend addFriendController) {
        this.addFriendController = addFriendController;
    }

    public PrivateInformation getPrivateInformationController() {
        return privateInformationController;
    }

    public void setPrivateInformationController(PrivateInformation privateInformationController) {
        this.privateInformationController = privateInformationController;
    }

    public loginController getLoginController() {
        return loginController;
    }

    public void setLoginController(loginController loginController) {
        this.loginController = loginController;
    }
}
